package com.sicau.socialpracticesystem.controller;


import com.sicau.socialpracticesystem.common.returning.ResultData;
import com.sicau.socialpracticesystem.entity.po.Points;
import com.sicau.socialpracticesystem.service.PointsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static com.sicau.socialpracticesystem.common.constant.UrlConstants.POINTS_PREFIX;

/**
 * <p>
 * 积分表 前端控制器
 * </p>
 *
 * @author sxt && ttxxi
 * @since 2021-04-26
 */
@RestController
@PreAuthorize("isAuthenticated()")
@RequestMapping(POINTS_PREFIX)
@Slf4j
@Api(tags = "积分相关")
public class PointsController {

    @Resource
    private PointsService pointsService;

    @GetMapping
    @ApiOperation("根据用户id查询")
    public ResultData<Points> queryById(@RequestParam Integer userId){
        return new ResultData<Points>().OK().setObj(pointsService.queryByUserId(userId));
    }


}

